#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <atlimage.h>
using namespace std;

#define BUFSIZE 1000

void _trace(LPCTSTR format, ...)
{
	TCHAR buffer[BUFSIZE];
	//memset(buffer, '\0', BUFSIZE);
	va_list argptr;
	va_start(argptr, format);
	wvsprintf(buffer, format, argptr);
	va_end(argptr);
	OutputDebugString(buffer);
}

void ImgTransparent(CImage * img)
{
	for(int i = 0; i < img->GetWidth(); i++)  
	{  
		for(int j = 0; j < img->GetHeight(); j++)  
		{  
			unsigned char* pucColor = reinterpret_cast<unsigned char *>(img->GetPixelAddress(i , j));  
			pucColor[0] = pucColor[0] * pucColor[3] / 255;  
			pucColor[1] = pucColor[1] * pucColor[3] / 255;  
			pucColor[2] = pucColor[2] * pucColor[3] / 255;  
		}  
	} 
}


